package com.zsc.oj.aop;

import com.zsc.oj.annotation.TestLog;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

@Aspect
@Component
public class TestInterceptor {

    @Around("@annotation(testLog)")
    public void doInterceptor(ProceedingJoinPoint joinPoint, TestLog testLog) throws Exception{
        String s = testLog.writeLog();
        if(s.equals("test")){
            System.out.println("切面成功");
        }
    }
}
